<script>


function nouveauacte(){

	id=$("input[name='ButterflyPortal_sys_rec']:checked").val();
	
$("#newacte_"+id).dialog({
	autoOpen: true,
	height: 230,
	width: 400,
	modal: true,
	zIndex: 3999,
	buttons: {
		"Save": function() {
			newacteId=$("input[name='newacteradio']:checked").val();
			savenewacte(id,newacteId);
		},
		Cancel: function() {
			$( this ).dialog( "close" );
		}
	}


	});
}





function savenewacte(soinId,newacteId)
{



	$.get("/portlet.php",
			{app: "cabinet",
			operation:"savenewacte",
			soinId:soinId,
			newacteId:newacteId
			},
			   function(data){
	            
				//alert(data);
			if (data=="ok") {

				location.reload();
				//alert("Nouveau Acte Ajouté");	

	
}else{
	
	alert("Problème survenu");
}

});

			
	
}


function nouveavance(dossierId){

    id=$("input[name='ButterflyPortal_sys_rec']:checked").val();

    $("#newavance_"+id).dialog({
        autoOpen: true,
        height: 160,
        width: 400,
        modal: true,
        zIndex: 3999,
        buttons: {
            "Ajouter": function() {
                montant=$("input[name='montant_"+id+"']").val();

             savenewavance(dossierId,montant);
             $( this ).dialog( "close" );
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        }


    });
}


function openflashdent(){

    

    $("#dentpicker").dialog({
        autoOpen: true,
        height: 400,
        width: 700,
        modal: true,
        zIndex: 3999,
        buttons: {
            Fermer: function() {
                $( this ).dialog( "close" );
            }
        }


    });
}
function savenewavance(dossierId,montant)
{

    $.get("/portlet.php",
        {app: "cabinet",
            operation:"savenewavance",
            dossierId:dossierId,
            montant:montant
        },
        function(data){
            //alert(data);
            if (data=="ok") {

              
              // alert("Nouveau avance Ajouté");


            }else{

                alert("Problème survenu");
            }

        });



}
</script>




